import { get, post } from "./index";

export interface IUser {
    id: string;
    role: number; // 角色 1-管理员 2-普通用户
    jobNum: string;
    name: string;
    permissionList: string;
}
// 登录
export const login = async (name: string, password: string): Promise<string> => {
    const res = await post("/user/login", { username: name, pwd: password });
    return res.data;
};

// 获取登录用户信息
export const getUserInfo = async (): Promise<IUser> => {
    const res = await post("/user/info", {});
    return res.data;
};

// 退出
export const logout = () => post("/user/logout", {});
